import Vue from 'vue'
import {getAction, postAction} from '@/api/manage'
import { readUnreadTotal } from '@/api/setting'





//获取首页消息总数
export function getReadTotal(that) {
  readUnreadTotal().then(res => {
    if (res.success) {
      that.msgTotal = res.result;
    } else {
      that.$message.warning(res.message);
    }
  })
}


// 获取所有的行业信息,或开票信息等... 公共方法
export function getPayMethodList(mack,url,that){
  //rootCode   103行业   102发票   101用工场景  3000000001快递列表
  let params ={};
  params.rootCode=mack;
  getAction(url,params).then((res)=>{
    if(res.success){
      // console.log(res)
      if(mack =='103'){
        that.dictOptions = res.result
      }else if(mack =='101'){
        that.categoryData = res.result
      }else if(mack =='102'){
        that.employmentData = res.result
        that.treeData = res.result[0].node;
      }else if(mack =='3000000001'){   //快递列表
        that.logistics = res.result[0].node
      }
    }else{
      that.$message.warning(res.message);
    }
  }).finally(() => {
    that.confirmLoading = false;
  })
}
